<#ibizinclude>
../@MACRO/CONTROL/CONTROL_HEADER-BASE.vue.ftl
</#ibizinclude>

    /**
     * 获取多项数据
     *
     * @returns {any[]}
     * @memberof ${srfclassname('${ctrl.codeName}')}Base
     */
    public getDatas(): any[] {
        return [];
    }

    /**
     * 获取单项树
     *
     * @returns {*}
     * @memberof ${srfclassname('${ctrl.codeName}')}Base
     */
    public getData(): any {
        return {};
    }


    /**
     * 选中数据
     *
     * @type {*}
     * @memberof ${srfclassname('${ctrl.codeName}')}Base
     */
    public selection: any = {};


    /**
     * 过滤值
     *
     * @type {string}
     * @memberof ${srfclassname('${ctrl.codeName}')}Base
     */
    public srffilter: string = '';

    /**
     * 关联视图信息集合
     *
     * @public
     * @type {boolean}
     * @memberof ${srfclassname('${ctrl.codeName}')}Base
     */
    public refViews: any = [
<#list view.getAllRelatedPSAppViews() as refview>
  <#if refview.getWFStepValue??>
        {
          viewName:"${srffilepath2(refview.codeName)}",
          wfstepValue:"${refview.getWFStepValue()}",
        },
  </#if>
</#list>
    ];


    /**
     * 分割宽度
     *
     * @type {string}
     * @memberof ${srfclassname('${ctrl.codeName}')}Base
     */
    public split: number = 0.2;

    /**
     * 获取关系项视图
     *
     * @param {*} [arg={}]
     * @returns {*}
     * @memberof ${srfclassname('${ctrl.codeName}')}Base
     */
    public select(index: any, indexs: any[]) {
        this.refViews.some((item:any) =>{
            if(Object.is("wfstep-"+item.wfstepValue, index)){
                this.selection = { viewName: item.viewName };
                return true;
            }
        });
    }

    /**
     * vue 声明周期
     *
     * @memberof  ${srfclassname('${ctrl.codeName}')}
     */
    public created() {
        this.afterCreated();
    }

    /**
     * 执行created后的逻辑
     *
     *  @memberof ${srfclassname('${ctrl.codeName}')}Base
     */    
    public afterCreated(){
        if (this.viewState) {
            this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
                if (!Object.is(tag, this.name)) {
                    return;
                }
            });
        }
    }

    /**
     * vue 生命周期
     *
     * @memberof ${srfclassname('${ctrl.codeName}')}Base
     */
    public destroyed() {
        this.afterDestroy();
    }

    /**
     * 执行destroyed后的逻辑
     *
     * @memberof ${srfclassname('${ctrl.codeName}')}Base
     */
    public afterDestroy() {
        if (this.viewStateEvent) {
            this.viewStateEvent.unsubscribe();
        }
        <#if destroyed_block??>
        ${destroyed_block}
        </#if>
    }    

    /**
     * 视图数据变化
     *
     * @param {*} $event
     * @memberof ${srfclassname('${ctrl.codeName}')}Base
     */
    public onViewDatasChange($event: any): void {
        this.$emit('selectionchange', $event);
    }

    /**
     * 视图数据被激活
     *
     * @param {*} $event
     * @memberof ${srfclassname('${ctrl.codeName}')}Base
     */
    public viewDatasActivated($event: any): void {
        this.$emit('activated', $event);
    }

    /**
     * 视图数据加载完成
     *
     * @param {*} $event
     * @memberof ${srfclassname('${ctrl.codeName}')}Base
     */
    public onViewLoad($event: any): void {
        this.$emit('load', $event);
    }
    
<#ibizinclude>
../@MACRO/CONTROL/CONTROL_BOTTOM-BASE.vue.ftl
</#ibizinclude>